export const AccessTokenKey = '__persisted_accessToken';
export const RefreshTokenKey = '__persisted_refreshToken';

export const getAccessToken = (): string => {
  return window.localStorage.getItem(AccessTokenKey) || '';
};

export const getRefreshToken = (): string => {
  return window.localStorage.getItem(RefreshTokenKey) || '';
};

export const setTokenInfo = (accessToken: string, refreshToken: string) => {
  setAccessToken(accessToken);
  setRefreshToken(refreshToken);
};

export const delTokenInfo = () => {
  delAccessToken();
  delRefreshToken();
};

export const setAccessToken = (accessToken: string) => {
  window.localStorage.setItem(AccessTokenKey, accessToken);
};

export const setRefreshToken = (refreshToken: string) => {
  window.localStorage.setItem(RefreshTokenKey, refreshToken);
};

export const delAccessToken = () => {
  window.localStorage.removeItem(AccessTokenKey);
};

export const delRefreshToken = () => {
  window.localStorage.removeItem(RefreshTokenKey);
};
